package com.bit.net.component.data.server;

import com.bit.net.BaseNettyServer;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 服务
 * <p>
 * 开启服务
 * </p>
 *
 * @since 2018/10/10
 */
@Slf4j
@Component
public class DataServer extends BaseNettyServer implements InitializingBean {

    public DataServer(@Value("${data.server.port}") int port, @Autowired DataServerChannelInitializer channelInitializer) {
        super(port, channelInitializer);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        this.start();
    }
}
